//
//  WHUtils.swift
//  kxf
//
//  Created by LNS2 on 2024/4/24.
//

import Foundation

class WHUtils: NSObject {
    //字符串转双精度后去除小数点00
    static func convertStringToString(_ str: String) -> String? {
        if let doubleValue = Double(str) {
            let numberFormatter = NumberFormatter()
            numberFormatter.minimumFractionDigits = 0
            numberFormatter.maximumFractionDigits = doubleValue.truncatingRemainder(dividingBy: 1) == 0 ? 0 : 2
            return numberFormatter.string(from: NSNumber(value: doubleValue))
        }
        return str
    }
}
